package javathread;

public class ThreadSafe1 {
    public static void main(String[] args) {
        window w1=new window();
        window w2=new window();
        window w3=new window();
        w1.setName("窗口1");
        w2.setName("窗口2");
        w3.setName("窗口3");
        w1.start();
        w2.start();
        w3.start();
    }
}

class window extends Thread{
    private  static int ticket=100;
    @Override
    public void run() {
       while(ticket>0){
           System.out.println(this.getName()+":"+ticket);
           ticket--;
       }
    }
}
